All Functions Used So Far, Week 9

geom_histogram

{GGPLOT2}

Generates a histogram

cat

{base}

Concatenate and print objects to the console without quotes or indices

order

{base}

Get indexes that will sort a vector

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

rm

{base}

Remove objects

hist

{graphics}

Plot a simple histogram

as.character

{base}

Coerce a vector to character

write.csv

{utils}

write a csv file to a data frame

ifelse

{base}

Return a or b depending on the value of test

replicate

{base}

Repeatedly evaluate an expression (wrapper around sapply)

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

setwd

{base}

Set Working Directory

read_dta

{haven}

Read a .dta file (Stata data)

recode_factor

{dplyr}

Recode factor values, changing the levels and their order

separate

{tidyr}

Split columns

with

{base}

evaluate expression in the context of a data frame

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

sprintf

{base}

C-style formatted string printing

theme_minimal

{GGPLOT2}

A minimalistic theme with no background annotations

qt

{stats}

Quantile function for t-distribution

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

geom_hline

{GGPLOT2}

Add a horizontal line in GGPLOT2

data.frame

{base}

Create a data.frame from vectors

cut

{base}

Convert Numeric to Factor

slice

{dplyr}

Select rows by position

factor

{base}

Create a factor

coord_cartesian

{GGPLOT2}

Zoom into a plot region without removing data (set Cartesian axis limits)

geom_abline

{GGPLOT2}

Add a reference line with a given slope and intercept

ordered

{dplyr}

Create an ordered factor

View

{base}

View a data frame

min

{base}

Get minimum of a vector

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

expression

{base}

Used in plots to add symbols to axes

quantile

{stats}

Obtain empirical quantiles of a vector

recode

{dplyr}

Recode a variable

ggplot

{GGPLOT2}

Create a ggplot graph

filter

{dplyr}

Filter out rows of a data frame according to logical vector

sqrt

{base}

Square-root function

n

{dplyr}

The number of observations in the current group.

labs

{GGPLOT2}

Customise labels in GGPLOT2

nrow

{base}

Get number of rows of a data frame

prop.test

{stats}

Test of Equal or Given Proportions

str

{utils}

Get the structure of an R object

which.min

{base}

Return the index of the smallest value in a vector

plot

{graphics}

Generic function from base R to produce a plot

install_rsthemes

{rsthemes}

Install the rsthemes collection of RStudio themes

summarize

{dplyr}

Collapse the dataset to a summary statistic (American-spelling alias of summarise)

complete.cases

{stats}

Find Complete Cases

write_dta

{haven}

Write Stata files

as.numeric

{base}

Coerce a vector to numeric

boxplot

{graphics}

Plot a simple box plot

ungroup

{dplyr}

Resolve grouping created with “group_by”

arrange

{dplyr}

Sort values of data frame according to a variable/combination of variables

sd

{stats}

Get standard deviation of a vector

mean

{base}

Get mean of a vector

set.seed

{base}

Initialise a pseudorandom number generator.

spread

{tidyr}

Spread a key-value pair across multiple columns

c

{base}

Combine values/vectors into a vector

sapply

{base}

Apply a function over a vector or list and simplify the result

var

{stats}

Calculate variance

factor

{base}

Create factor variables

max

{base}

Get maximum of a vector

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

levels

{base}

Get levels of a factor

mutate

{dplyr}

Create new variables

stat_ecdf

{GGPLOT2}

Compute empirical cumulative distribution

round

{base}

Rounds numbers

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

length

{base}

Returns number of elements in an object

geom_line

{GGPLOT2}

Generates a line

install.packages

{utils}

Install R packages

which.max

{base}

return index of the largest value in a vector

save

{base}

Save R objects

exists

{base}

Test whether a named object/variable exists

pt

{stats}

Calculate the cumulative distribution function of the t-distribution

library

{base}

Load an R package

head

{utils}

Show first 5 rows of a data frame

pwr.t.test

{pwr}

Calculate power, sample size, or effect size for t-tests

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

sum

{base}

Get sum of numeric values or a vector

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

read_excel

{readxl}

Read an Excel file

seq

{base}

Create a sequence

summary

{base}

Obtain summary statistics or detailed regression output

rnorm

{base}

Generate random numbers from a normal distribution

is.na

{base}

Check if a value is NA/elements of vector are NA

ceiling

{base}

Round numbers up to the smallest following integer

median

{stats}

Get median of a vector

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

names

{base}

Get or set names of an object

range

{base}

Return range of values

print

{base}

Print object to the console

tibble

{tibble}

A modern data frame from the tidyverse

aggregate

{stats}

Compute summary statistics of data subsets / by groups

power.t.test

{stats}

Power calculations for one- and two-sample t-tests

desc

{dplyr}

Arrange in descending order

select

{dplyr}

Select columns from a tibble/data frame

The end!